package com.cbtx.module.common.vm

import android.app.Application
import android.content.Intent
import android.graphics.Bitmap
import com.cbtx.module.base.vm.BaseVM
import com.cbtx.module.common.bean.GoodsEntity
import com.cbtx.module.common.http.HttpUrlManager
import com.txcb.lib.base.utils.DeviceUtil
import com.txcb.lib.base.utils.ZxingUtils

class RenZhengDetailVM(application: Application) : BaseVM(application) {



    var renZhengItem: GoodsEntity.DataBean.ListBean? = null
    var mPriceStr = "藏品价位："
    fun getIntent(intent: Intent) {

        renZhengItem = intent.getSerializableExtra("renZhengItem") as GoodsEntity.DataBean.ListBean

        renZhengItem?.category = "藏品类别：${renZhengItem?.category}"
        renZhengItem?.years= "藏品年代：${renZhengItem?.years}"
//        renZhengItem?.a = "藏品地区：${renZhengItem?.addressname}"

        mPriceStr = "$mPriceStr${renZhengItem?.insurancePrice}元"


    }

    fun getQrBitmap(): Bitmap {

        //mAndroidId
        val url = "${HttpUrlManager.DEVICE_WXQRCODE}${DeviceUtil.getSerialNumber(mApplication)}"

        return ZxingUtils.createQRCode(url, 114,0)
    }
}